@import 'shared.scss';

:local(.presence-log) {
  align-self: flex-start;
  flex: 10;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  margin-bottom: 8px;
  margin-top: 90px;
  overflow: hidden;
  width: 100%;

  :local(.presence-log-entry) {
    @extend %default-font;
    pointer-events: auto;

    user-select: text;
    -moz-user-select: text;
    -webkit-user-select: text;
    -ms-user-select: text;

    background-color: var(--lobby-overlay-widget-background-color);
    color: var(--lobby-overlay-widget-text-color);
    margin: 0px 64px 8px 8px;
    font-size: 0.8em;
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;

    :local(.message-body) {
      margin-left: 4px;
      white-space: pre;
    }

    :local(.message-body-multi) {
      margin-left: 0px;
    }

    :local(.message-body-mono) {
      font-family: monospace;
      font-size: 14px;
    }

    :local(.message-wrap) {
      display: flex;
      align-items: center;
      justify-content: center;
    }

    :local(.message-wrap-multi) {
      display: flex;
      align-items: flex-start;
      justify-content: center;
      flex-direction: column;
    }

    :local(.message-source) {
      align-self: flex-start;
      font-weight: bold;
    }

    :local(.message-source-link) {
      cursor: pointer;
      text-decoration: underline;
    }

    a {
      color: $action-label-color;
    }

    @media (max-width: 1000px) {
      max-width: 75%;
    }

    :local(.icon-button) {
      appearance: none;
      -moz-appearance: none;
      -webkit-appearance: none;
      outline-style: none;
      width: 24px;
      height: 24px;
      background-size: 20px;
      background-position: center;
      background-repeat: no-repeat;
      border: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      cursor: pointer;
      margin-right: 6px;
      border-radius: 12px;
      background-color: transparent;

      &:hover {
        @media (pointer: fine) {
          background-color: $action-color;
        }
      }
    }

    :local(.spawn-message) {
      background-image: url(../images/spawn_message.png);
    }

    // TODO replace these icons with share button
    :local(.share) {
      background-image: url(../images/share_message.png);
    }

    &:local(.media) {
      display: flex;
      align-items: center;
      min-height: 35px;

      :local(.mediaBody) {
        display: flex;
        flex-direction: column;
      }

      img {
        height: 35px;
        margin-left: 8px;
        border: 2px solid var(--lobby-overlay-widget-thumbnail-border-color);
        display: block;
        border-radius: 5px;
      }
    }
  }

  :local(.expired) {
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: visibility 0s 0.5s, opacity 0.5s linear, transform 0.5s;
  }

  :local(.presence-log-entry-with-button) {
    padding: 8px 18px 8px 10px;
  }
}

:local(.presence-log-in-room) {
  position: absolute;
  bottom: 64px;
  z-index: 1;
  left: 50%;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  width: 95%;
  max-width: 700px;

  :local(.presence-log-entry) {
    background-color: var(--hud-panel-background);
    color: var(--hud-panel-text-color);
    min-height: 18px;

    // If this is selectable, tap holding on mobile anywhere on the screen will result
    // in a selection.
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;

    a {
      color: var(--hud-panel-link-color);
    }
  }
}

:local(.presence-log-spawn) {
  position: absolute;
  top: 0;
  z-index: -10;
  width: auto;
  margin: 0;

  :local(.presence-log-entry) {
    background-color: var(--spawned-overlay-widget-background-color);
    color: var(--spawned-overlay-widget-text-color);
    min-height: 18px;
    padding: 8px 16px;
    border-radius: 16px;
    line-height: 18px;
    margin: 0;
    max-width: 100%;

    :local(.message-body) {
      margin-left: 0;
    }

    a {
      color: var(--spawned-overlay-widget-link-color);
    }
  }

  :local(.presence-log-entry-one-line) {
    font-weight: bold;
    line-height: 19px;
    text-align: center;
  }

  :local(.presence-log-emoji) {
    background-color: transparent;
    padding: 0;
    margin: 0;
  }

  :local(.message-wrap) {
    flex-direction: column;
  }

  :local(.message-source) {
    font-weight: normal;
    font-size: 0.7em;
    white-space: nowrap;
    color: var(--spawned-overlay-widget-source-text-color);
  }

  :local(.message-source-link) {
    cursor: pointer;
    text-decoration: underline;
  }
}

:local(.emoji) {
  // Undo annoying CSS in emoji plugin
  margin: auto !important;
  vertical-align: 0em !important;
}
